/**
 * 
 */
package au.com.betaversion.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import au.com.betaversion.domain.Photo;
import au.com.betaversion.repository.PhotoRepository;

/**
 * @author 103085
 *
 */
@Service
public class PhotoServiceImpl implements PhotoService {
	
	@Autowired
	private PhotoRepository fileRepository;

	/* (non-Javadoc)
	 * @see au.com.betaversion.service.PhotoService#increseView(java.lang.String)
	 */
	@Override
	public Photo increaseView(String id) {
		Photo uploadFile = fileRepository.findOne(id);
		int currentViews = uploadFile.getViews();
		uploadFile.setViews(++currentViews);
		return fileRepository.save(uploadFile);
	}

}
